import { Link, Outlet, Navigate, useLocation } from "react-router-dom"

let Discover = () => {

    let location = useLocation()
    // console.log(location.pathname)
    return (
        <fieldset>
            <legend>Discover</legend>
            <h1>Discover</h1>
            <Link to="/discover/playlist">歌单</Link>
            <br />
            <Link to="/discover/toplist?name=李雷">排行榜</Link>

            {/* 重定向的额外处理 需要添加一些条件 */}
            {location.pathname === "/discover" && <Navigate to="/discover/playlist" />}

            <Outlet />
        </fieldset>
    )
}

export default Discover